package com.czr.util;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.czr.dao.entity.CzrNews;

public class PageUtil {

    public static JSONObject getPage(JSONArray array, Page<?> page){
        JSONObject resultJSON=new JSONObject();
        resultJSON.put("records",array);
        resultJSON.put("total",page.getTotal());
        resultJSON.put("size",page.getSize());
        resultJSON.put("current",page.getCurrent());
        resultJSON.put("orders",page.getOrders());
        resultJSON.put("optimizeCountSql",page.optimizeCountSql());
        resultJSON.put("hitCount",page.isHitCount());
        resultJSON.put("countId",page.getCountId());
        resultJSON.put("maxLimit",page.getMaxLimit());
        resultJSON.put("searchCount",page.isSearchCount());
        resultJSON.put("pages",page.getPages());
        return resultJSON;
    }
}
